class InitialSchema < ActiveRecord::Migration
  def self.up
    create_table :users do |t|
        t.column :login, :string
        t.column :name, :string
        t.column :password, :string
        t.column :created_at, :datetime        
    end
    
    create_table :categories do |t|
        t.column :name, :string
    end

    create_table :articles do |t|
        t.column :user_id, :integer
        t.column :category_id, :integer
        t.column :title, :string
        t.column :body, :text
        t.column :body_html, :text
        t.column :created_at, :datetime
        t.column :updated_at, :datetime
    end
    
    create_table :comments do |t|
        t.column :article_id, :integer
        t.column :author, :string
        t.column :body, :text
        t.column :body_html, :text
        t.column :created_at, :datetime
    end
  end

  def self.down
    drop_table :comments
    drop_table :articles
    drop_table :categories
    drop_table :users    
  end
end
